cmake_minimum_required(VERSION 3.0.0)
project(yolo_ort)

set(ONNXRUNTIME_DIR ${CMAKE_SOURCE_DIR})
message(STATUS "ONNXRUNTIME_DIR: ${ONNXRUNTIME_DIR}")

# 查找 OpenCV 库
find_package(OpenCV REQUIRED)
# 查找 OpenSSL 库
find_package(OpenSSL REQUIRED)

# 添加 OpenSSL 头文件目录
include_directories(${OPENSSL_INCLUDE_DIR})

include_directories("include/")

add_compile_definitions(MODEL_DECRYPTO OLY_KEY)
add_executable(yolo_ort ./src/main.cpp ./src/yolov8_seg_onnx.cpp ./src/yolov8_utils.cpp)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

target_include_directories(yolo_ort PRIVATE "${ONNXRUNTIME_DIR}/include")
# link_directories("${ONNXRUNTIME_DIR}/lib")
target_compile_features(yolo_ort PRIVATE cxx_std_14)
target_link_libraries(yolo_ort libcryptopp.so ${OPENSSL_LIBRARIES} ${OpenCV_LIBS})

if (WIN32)
    target_link_libraries(yolo_ort "${ONNXRUNTIME_DIR}/lib/onnxruntime.lib")
endif(WIN32)

if (UNIX)
    target_link_libraries(yolo_ort "${ONNXRUNTIME_DIR}/lib/libonnxruntime.so")
endif(UNIX)

